#include "UdpServer.hpp"
#include "Route.hpp"
#include <memory>
using namespace log_ns;
int main(int argc, char* argv[]) //命令行参数获取服务器端的端口号，ip地址默认给0
{
    if(argc != 2)
    {
        std::cerr << "Usage: " << "local_port" << std::endl;
        exit(0);
    }
    uint16_t port = std::stoi(argv[1]); //获取端口号
    EnableScreen(); //日志系统，可以修改日志输出位置
    Route messageRoute; //创建转发对象
    service_t message_route = std::bind(&Route::Forword, &messageRoute, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); //绑定转发
    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(message_route, port); //智能指针 创建服务器对象，c++14标准
    usvr->InitServer();
    usvr->Start();
    return 0;
}